package com.alfayun.fiscalriskanalysis.importer;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

public class ImporterFactory {

	private static Map<String, String> classNames = Map.of("FS_001", "com.alfayun.fiscalriskanalysis.importer.FS001Importer");

	public static Importer getImporter(String reportIndex) {
		if (reportIndex == null) {
			return null;
		}
		String className = classNames.get(reportIndex);
		
		try {
			return (Importer) Class.forName(className).getConstructor(null).newInstance(null);
		} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
				| NoSuchMethodException | SecurityException | ClassNotFoundException e) {
			e.printStackTrace();
			return null;
		}
	}

}
